package com.quasar.hpatient.presenter;

import com.quasar.hpatient.model.httpmodel.AnotherResult;
import com.quasar.hpatient.model.httpmodel.DataStateResult;
import com.quasar.hpatient.model.medicalmodel.PushinfoData;
import com.quasar.hpatient.model.requestmodel.RequestModel;
import com.quasar.hpatient.onInterface.AnotherResultListener;
import com.quasar.hpatient.onInterface.OnJpshListener;

/**
 * author : 许建宏
 * Date: 2017/12/8 0008
 * View:
 */

public class JpshPresenter {

    private RequestModel requestModel;
    private OnJpshListener onJpshListener;

    public JpshPresenter(OnJpshListener onJpshListener) {
        this.requestModel = new RequestModel();
        this.onJpshListener = onJpshListener;
    }

    /**
     * 消息展示
     * @param page
     */
    public void GetUserLatestMessageData(String page){

        requestModel.GetUserLatestMessageData(page, new AnotherResultListener<AnotherResult<PushinfoData>>() {
            @Override
            public void onSuccess(AnotherResult<PushinfoData> data) {
                onJpshListener.onJpshSuccess(data);
            }

            @Override
            public void onError(String msg) {
                onJpshListener.onJpshError(msg);
            }

            @Override
            public void onRefreshUI() {
                onJpshListener.onJpshRefreshUI();
            }
        });
    }

    //查看消息
    public void UpdateUserMessage(String id){
        requestModel.UpdateUserMessageData(id, new AnotherResultListener<DataStateResult>() {
            @Override
            public void onSuccess(DataStateResult data) {
                onJpshListener.onLookSuccessMsg(data);
            }

            @Override
            public void onError(String msg) {
                onJpshListener.onJpshError(msg);
            }

            @Override
            public void onRefreshUI() {
                onJpshListener.onJpshRefreshUI();
            }
        });
    }
    //查看复诊信息
    public void VisitMessage(){

        requestModel.GetUserLatestMessageExData(new AnotherResultListener<AnotherResult<PushinfoData>>() {
            @Override
            public void onSuccess(AnotherResult<PushinfoData> data) {
                onJpshListener.onVisitMessageSuccess(data);
            }

            @Override
            public void onError(String msg) {
                onJpshListener.onJpshError(msg);
            }

            @Override
            public void onRefreshUI() {
                onJpshListener.onJpshRefreshUI();
            }
        });
    }
}
